package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.PanelContent;
import com.mall.shopping.dto.PanelContentDto;
import com.mall.shopping.dto.PanelContentItemDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author 谭涛
 */
@Mapper(componentModel = "spring")
public interface PanelContentConverter {

    @Mappings({
            @Mapping(source = "id",target = "id"),
            @Mapping(source = "panelId",target = "panelId"),
            @Mapping(source = "type",target = "type"),
            @Mapping(source = "productId",target = "productId"),
            @Mapping(source = "sortOrder",target = "sortOrder"),
            @Mapping(source = "fullUrl",target = "fullUrl"),
            @Mapping(source = "picUrl",target = "picUrl"),
            @Mapping(source = "picUrl2",target = "picUrl2"),
            @Mapping(source = "picUrl3",target = "picUrl3"),
            @Mapping(source = "created",target = "created"),
            @Mapping(source = "updated",target = "updated")
    })
    PanelContentItemDto panelContent2Dto (PanelContent panelContent);

    List<PanelContentItemDto> panelContents2Dto (List<PanelContent> panelContents);
}
